import java.util.Calendar;

public class Bill extends Item{
	
	//the date attribute extended from item in this class represents the lastPaidDate
	private Calendar nextPayDate;
	
	public Bill(String description, Calendar lastPaidDate, Calendar nextPayDate,int index){
		super(description, lastPaidDate,index);
		this.setNextPayDate(nextPayDate);
	}

	public Calendar getLastPaidDate() {
		return date;
	}

	public void setLastPaidDate(Calendar lastPaidDate) {
		this.date = lastPaidDate;

	}

	public Calendar getNextPayDate() {
		return nextPayDate;
	}

	public void setNextPayDate(Calendar nextPayDate) {
		this.nextPayDate = nextPayDate;
	}
	
	public void payBill(Calendar date){
		setLastPaidDate(date);
		
		Calendar today=Calendar.getInstance();
		
		while(today.after(nextPayDate)){
			nextPayDate.add(Calendar.MONTH, 1);
		}
	}
	
	


}
